Skip to content

Fix for failing test #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2025
Merged

Fix for failing test #215

merged 1 commit into from
Apr 20, 2025

Conversation

espg
Copy link
Collaborator

@espg espg commented Apr 18, 2025

over_cluster was modified to default to the new 'static' keyword for the method parameter; this fixes the failing test by telling it to run on the previous version instead of the new method (new method will need it's own test).

@espg
Copy link
Collaborator Author

espg commented Apr 18, 2025

Oh, yay, tests are running on pull requests now! One of the things that I included in #214 was an update to our CI/CD pipeline.

Previously, if I created a branch in demiangomez/Parallel.GAMIT, and requested a PR against master, tests would run (as expected). However, if I cloned Parallel.GAMIT (i.e., into espg/Parallel.GAMIT) and then opened a pull request against the demiangomez/Parallel.GAMIT master branch, the unit tests wouldn't run-- this is why we didn't see the failing unit test in #214 until after you approved and rebased-merged.

Now, with us calling our test workflow on any pull_request_target actions, we'll run tests on PR when we (and others) use proper git hygiene by not working in master and cloning the repo...

@espg
Copy link
Collaborator Author

espg commented Apr 18, 2025

@demiangomez this can get merged. The reason this is failing is because the test suite is running the current code inside of the pgamit master branch:

def test_max_clust_expansion(min_clust, max_clust, neighbors, overlap):
        """Test algorithmic guarantee of `over_cluster`
    
        Verify that expanded cluster size is under (<=, less than or equal to):
        [initial cluster size + (neighbors * overlap)]"""
    
        data = gen_variable_density_clusters()
        clust = BisectingQMeans(min_size=min_clust, opt_size=max_clust,
                                init='random', n_init=50, algorithm='lloyd',
                                max_iter=8000, random_state=[42]
        clust.fit(data)
    
        OC = over_cluster(clust.labels_, data, metric='euclidean',
                          neighbors=neighbors, overlap_points=overlap)

while this PR is modifying the unit test that is failing:

    OC = over_cluster(clust.labels_, data, metric='euclidean', 
                      neighbors=neighbors, overlap_points=overlap,
                      method='dynamic')

The pull_request_target workflow uses the current master branch of demiangomez/Parallel.GAMIT for running tests-- the reason is because if it used the PR codebase for tests, then the PR submitter could change the test code to do something annoying/nefarious (i.e., a bot could submit PR's that would modify the test actions to send spam email or otherwise hijack the git runner image).

We'll see real-time test results for PR's that don't modify the test suites... and for anything that does add a new test, we'll see it delayed. That said, the 'on push' workflow will still show it correctly as passing inside of the cloned repo where the PR is coming from (i.e., this PR does pass tests in my repo since my repo runs tests using code from itself (espg/Parallel.GAMIT), rather than from the upstream demiangomez/Parallel.GAMIT master branch).

@demiangomez demiangomez merged commit 70287ba into demiangomez:master Apr 20, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants